home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 17 / CU Amiga Magazine's Super CD-ROM 17 (1997)(EMAP Images)(GB)[!][issue 1997-12].iso / CUCD / Programming / DiceSource / lib / string / strncat.c < prev    next >
C/C++ Source or Header  |  1997-09-09  |  549b  |  44 lines

  1.  
  2. /*
  3.  *  STRNCAT.C
  4.  *
  5.  *    (c)Copyright 1992-1997 Obvious Implementations Corp.  Redistribution and
  6.  *    use is allowed under the terms of the DICE-LICENSE FILE,
  7.  *    DICE-LICENSE.TXT.
  8.  */
  9.  
  10. #include <string.h>
  11.  
  12. typedef unsigned char ubyte;
  13.  
  14. #ifndef HYPER
  15. #define HYPER(x) x
  16. #endif
  17.  
  18. char *
  19. HYPER(strncat)(d, s, n)
  20. char *d;
  21. const char *s;
  22. size_t n;
  23. {
  24.     char c;
  25.     char *base= d;
  26.  
  27.     s;
  28.     n;
  29.  
  30.     if (n) {
  31.     d += strlen(d);
  32.     while (c = *s) {
  33.         *d = c;
  34.         ++s;
  35.         ++d;
  36.         if (--n == 0)
  37.         break;
  38.     }
  39.     }
  40.     *d = 0;
  41.     return(base);
  42. }
  43.  
  44.